package com.zr.userrelation.mapper;


import com.zr.userrelation.pojo.UserRelation;
import com.zr.userrelation.pojo.UserRelationAddVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * Created by star on 2019/7/3.
 */
@Mapper
public interface UserRelationMapper {
    @Insert("insert into userrelation(familyContacts,relationsWithMe,contactTelephone,commonFamilyContacts,commonRelationsWithMe,commonPhone,createTime,createName,updateTime," +
            "updateName) values (#{familyContacts},#{relationsWithMe},#{contactTelephone},#{commonFamilyContacts},#{commonRelationsWithMe},#{commonPhone},#{createTime},#{createName},#{updateTime},#{updateName})")
    int addContacts(UserRelation userRelation);

    @Select("select familyContacts,relationsWithMe,contactTelephone,commonFamilyContacts,commonRelationsWithMe,commonPhone from userrelation where loginId=#{loginId}")
    UserRelationAddVo queryLoginId(Integer loginId);

    @Update("update userrelation set familyContacts=#{familyContacts},relationsWithMe=#{relationsWithMe},contactTelephone=#{contactTelephone},commonFamilyContacts=#{commonFamilyContacts},commonRelationsWithMe=#{commonRelationsWithMe}," +
            "commonPhone=#{commonPhone},updateTime=#{updateTime},updateName=#{updateName} where loginId=#{loginId}")
    int updateContacts(UserRelation userRelation);
}
